import request from "@/utils/request";

export default {
    getList(data) {
        return request({
            url: "/api/accounts/roles/",
            method: "get",
            params:data
        });
    },
    getSimpleList(data) {
      return request({
        url: "/api/accounts/roles/simple/",
        method: "get",
        params:data
      });
    },
    getRolesPermission(data) {
      return request({
        url: "/api/accounts/roles/permission/",
        method: "get",
        params:data
      });
    },
    getDetailInfoById(id,data) {
        return request({
            url: "/api/accounts/roles/"+id+"/",
            method: "get",
            params:data
        });
    },
//添加角色
    toAdd(data) {
        return request({
            url: "/api/accounts/roles/",
            method: "post",
            data
        });
    },

//编辑角色
    toEdit(id, data) {
        return request({
            url: "/api/accounts/roles/" + id+"/",
            method: "put",
            data
        });
    },
    //编辑角色菜单
    editRoleMenu(id, data) {
        return request({
            url: "/api/accounts/roles/" + id+"/",
            method: "put",
            data
        });
    },
//删除角色
    toDelete(id) {
        return request({
            url: "/api/accounts/roles/" + id+"/",
            method: "delete"
        });
    },

//获取角色用户列表
    getRoleUser(data) {
        return request({
            url: "/api/accounts/roles/" + data.id + "/users/",
            method: "get",
            params:data
        });
    },

//删除角色用户信息
    deleteRoleUser(id, roleId) {
        return request({
            url: "/api/accounts/roles/" + id + "/users/" + roleId + "/",
            method: "delete"
        });
    },

//添加角色
    addRoleUser(id, data) {
        return request({
            url: "/api/accounts/roles/" + id + "/users/",
            method: "post",
            data
        });
    },

//搜索角色
    searchRoleUser(id, value) {
        return request({
            url: "/api/accounts/roles/" + id + "/users/?search_value=" + value,
            method: "get"
        });
    },
    //获取用户简要信息列表(搜索)
    getSimpleUser(value) {
        return request({
            url: "/api/accounts/users/simple/?search_value=" + value,
            method: "get"
        });
    },
    getRoleMenu(data){
        return request({
            url: "/api/accounts/roles/role_id_to_menu/",
            method: "get",
            params:data
        });
    },
    rolesQingkong(id,data){
        return request({
            url: "/api/accounts/roles/"+id+"/qingkong/",
            method: "put",
            data:data
        });
    }
}
